<?php

class Zend_Validate_EmailMatch extends Zend_Validate_Abstract
{
    const EMAIL_MISMATCH = 'emailMismatch';

     protected $_compare;

    public function __construct($compare)
    {
        $this->_compare = $compare;
    }

    protected $_messageTemplates = array(
        self::EMAIL_MISMATCH => "Email doesn't match confirmation"
    );

    public function isValid($value)
    {
        $this->_setValue((string) $value);

        if ($value !== $this->_compare)  {
            $this->_error(self::EMAIL_MISMATCH);
            return false;
        }

        return true;
    }

}